﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:button="clr-namespace:myManga_App.Resources.Theme.Buttons">

    <Style
        x:Key="ButtonFocusVisual">
        <Setter
            Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                    <Rectangle Margin="2" SnapsToDevicePixels="true" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeThickness="1" StrokeDashArray="1 2" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type button:MetroButton}">
        <Setter Property="BorderBrush" Value="{x:Null}"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Foreground" Value="{DynamicResource window-foreground}"/>
        <Setter Property="Background" Value="{DynamicResource window-background}"/>
        <Setter Property="PrimaryBrush" Value="{DynamicResource window-theme-primary}"/>
        <Setter Property="SecondaryBrush" Value="{DynamicResource window-theme-secondary}"/>
        <Setter Property="PrimaryDisabledBrush" Value="{DynamicResource window-theme-primary-disabled}"/>
        <Setter Property="SecondaryDisabledBrush" Value="{DynamicResource window-theme-secondary-disabled}"/>

        <Setter Property="Padding" Value="4"/>
        <Setter Property="Margin" Value="0"/>
        <Setter Property="FocusVisualStyle" Value="{DynamicResource ButtonFocusVisual}"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>

        <Setter Property="HorizontalAlignment" Value="Stretch"/>
        <Setter Property="VerticalAlignment" Value="Stretch"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type button:MetroButton}">
                    <Border
                        x:Name="Chrome"
                        Margin="{TemplateBinding Margin}"
                        Padding="{TemplateBinding Padding}"
                        SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        Background="{TemplateBinding Background}">
                        <ContentPresenter
                            x:Name="Content"
                            Content="{TemplateBinding Content}"
                            ContentTemplate="{TemplateBinding ContentTemplate}"
                            ContentStringFormat="{TemplateBinding ContentStringFormat}"
                            TextElement.Foreground="{TemplateBinding Foreground}"
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="Chrome" Property="Background" Value="{Binding Path=SecondaryBrush, RelativeSource={RelativeSource AncestorType={x:Type button:MetroButton}}}"/>
                            <Setter TargetName="Content" Property="TextElement.Foreground" Value="{Binding Path=PrimaryBrush, RelativeSource={RelativeSource AncestorType={x:Type button:MetroButton}}}"/>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter TargetName="Chrome" Property="Background" Value="{Binding Path=PrimaryBrush, RelativeSource={RelativeSource AncestorType={x:Type button:MetroButton}}}"/>
                            <Setter TargetName="Content" Property="TextElement.Foreground" Value="{Binding Path=SecondaryBrush, RelativeSource={RelativeSource AncestorType={x:Type button:MetroButton}}}"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="Chrome" Property="Background" Value="{Binding Path=SecondaryDisabledBrush, RelativeSource={RelativeSource AncestorType={x:Type button:MetroButton}}}"/>
                            <Setter TargetName="Content" Property="TextElement.Foreground" Value="{Binding Path=PrimaryDisabledBrush, RelativeSource={RelativeSource AncestorType={x:Type button:MetroButton}}}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type button:MetroToggleButton}">
        <Setter Property="BorderBrush" Value="{x:Null}"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Foreground" Value="{DynamicResource window-foreground}"/>
        <Setter Property="Background" Value="{DynamicResource window-background}"/>
        <Setter Property="PrimaryBrush" Value="{DynamicResource window-theme-primary}"/>
        <Setter Property="SecondaryBrush" Value="{DynamicResource window-theme-secondary}"/>
        <Setter Property="PrimaryDisabledBrush" Value="{DynamicResource window-theme-primary-disabled}"/>
        <Setter Property="SecondaryDisabledBrush" Value="{DynamicResource window-theme-secondary-disabled}"/>

        <Setter Property="Padding" Value="4"/>
        <Setter Property="Margin" Value="0"/>
        <Setter Property="FocusVisualStyle" Value="{DynamicResource ButtonFocusVisual}"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>

        <Setter Property="HorizontalAlignment" Value="Stretch"/>
        <Setter Property="VerticalAlignment" Value="Stretch"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type button:MetroToggleButton}">
                    <Border
                        x:Name="Chrome"
                        Margin="{TemplateBinding Margin}"
                        Padding="{TemplateBinding Padding}"
                        SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        Background="{TemplateBinding Background}">
                        <ContentPresenter
                            x:Name="Content"
                            Content="{TemplateBinding Content}"
                            ContentTemplate="{TemplateBinding ContentTemplate}"
                            ContentStringFormat="{TemplateBinding ContentStringFormat}"
                            TextElement.Foreground="{TemplateBinding Foreground}"
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="Chrome" Property="Background" Value="{Binding Path=SecondaryBrush, RelativeSource={RelativeSource AncestorType={x:Type button:MetroToggleButton}}}"/>
                            <Setter TargetName="Content" Property="TextElement.Foreground" Value="{Binding Path=PrimaryBrush, RelativeSource={RelativeSource AncestorType={x:Type button:MetroToggleButton}}}"/>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter TargetName="Chrome" Property="Background" Value="{Binding Path=PrimaryBrush, RelativeSource={RelativeSource AncestorType={x:Type button:MetroToggleButton}}}"/>
                            <Setter TargetName="Content" Property="TextElement.Foreground" Value="{Binding Path=SecondaryBrush, RelativeSource={RelativeSource AncestorType={x:Type button:MetroToggleButton}}}"/>
                        </Trigger>
                        <Trigger Property="IsChecked" Value="True">
                            <Setter TargetName="Chrome" Property="Background" Value="{Binding Path=PrimaryBrush, RelativeSource={RelativeSource AncestorType={x:Type button:MetroToggleButton}}}"/>
                            <Setter TargetName="Content" Property="TextElement.Foreground" Value="{Binding Path=SecondaryBrush, RelativeSource={RelativeSource AncestorType={x:Type button:MetroToggleButton}}}"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="Chrome" Property="Background" Value="{Binding Path=SecondaryDisabledBrush, RelativeSource={RelativeSource AncestorType={x:Type button:MetroToggleButton}}}"/>
                            <Setter TargetName="Content" Property="TextElement.Foreground" Value="{Binding Path=PrimaryDisabledBrush, RelativeSource={RelativeSource AncestorType={x:Type button:MetroToggleButton}}}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type button:MetroRadioButton}">
        <Setter Property="BorderBrush" Value="{x:Null}"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Foreground" Value="{DynamicResource window-foreground}"/>
        <Setter Property="Background" Value="{DynamicResource window-background}"/>
        <Setter Property="PrimaryBrush" Value="{DynamicResource window-theme-primary}"/>
        <Setter Property="SecondaryBrush" Value="{DynamicResource window-theme-secondary}"/>
        <Setter Property="PrimaryDisabledBrush" Value="{DynamicResource window-theme-primary-disabled}"/>
        <Setter Property="SecondaryDisabledBrush" Value="{DynamicResource window-theme-secondary-disabled}"/>

        <Setter Property="Padding" Value="4"/>
        <Setter Property="Margin" Value="0"/>
        <Setter Property="FocusVisualStyle" Value="{DynamicResource ButtonFocusVisual}"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>

        <Setter Property="HorizontalAlignment" Value="Stretch"/>
        <Setter Property="VerticalAlignment" Value="Stretch"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type button:MetroRadioButton}">
                    <Border
                        x:Name="Chrome"
                        Margin="{TemplateBinding Margin}"
                        Padding="{TemplateBinding Padding}"
                        SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        Background="{TemplateBinding Background}">
                        <ContentPresenter
                            x:Name="Content"
                            Content="{TemplateBinding Content}"
                            ContentTemplate="{TemplateBinding ContentTemplate}"
                            ContentStringFormat="{TemplateBinding ContentStringFormat}"
                            TextElement.Foreground="{TemplateBinding Foreground}"
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="Chrome" Property="Background" Value="{Binding Path=SecondaryBrush, RelativeSource={RelativeSource AncestorType={x:Type button:MetroRadioButton}}}"/>
                            <Setter TargetName="Content" Property="TextElement.Foreground" Value="{Binding Path=PrimaryBrush, RelativeSource={RelativeSource AncestorType={x:Type button:MetroRadioButton}}}"/>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter TargetName="Chrome" Property="Background" Value="{Binding Path=PrimaryBrush, RelativeSource={RelativeSource AncestorType={x:Type button:MetroRadioButton}}}"/>
                            <Setter TargetName="Content" Property="TextElement.Foreground" Value="{Binding Path=SecondaryBrush, RelativeSource={RelativeSource AncestorType={x:Type button:MetroRadioButton}}}"/>
                        </Trigger>
                        <Trigger Property="IsChecked" Value="True">
                            <Setter TargetName="Chrome" Property="Background" Value="{Binding Path=PrimaryBrush, RelativeSource={RelativeSource AncestorType={x:Type button:MetroRadioButton}}}"/>
                            <Setter TargetName="Content" Property="TextElement.Foreground" Value="{Binding Path=SecondaryBrush, RelativeSource={RelativeSource AncestorType={x:Type button:MetroRadioButton}}}"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="Chrome" Property="Background" Value="{Binding Path=SecondaryDisabledBrush, RelativeSource={RelativeSource AncestorType={x:Type button:MetroRadioButton}}}"/>
                            <Setter TargetName="Content" Property="TextElement.Foreground" Value="{Binding Path=PrimaryDisabledBrush, RelativeSource={RelativeSource AncestorType={x:Type button:MetroRadioButton}}}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>